package cn.wolfcode.luowowo.search.impl;

import cn.wolfcode.luowowo.repository.TravelTemplateRepository;
import cn.wolfcode.luowowo.search.service.ITravelSearchService;
import cn.wolfcode.luowowo.search.template.TravelTemplate;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service
public class TravelSearchServiceImpl implements ITravelSearchService {

    @Autowired
    private TravelTemplateRepository repository;

    /**
     * 游记对象的es保存操作
     */
    public void save(TravelTemplate template) {
        repository.save(template);
    }

    /**
     * 站内搜索之通过目的地的名字查询游记
     * @param destName
     * @return
     */
    public List<TravelTemplate> listByDestName(String destName) {
        List<TravelTemplate> byDestName = repository.findByDestName(destName);
        return byDestName;
    }
}
